package com.taihua.faxmail.gol;

import java.sql.ResultSet;
import java.sql.SQLException;

import control.database.DataBase;

public class ValidateCode {

public  String [] getCode(String phs_num) throws NumberFormatException, SQLException   
{
	String[] strs = new String[3];
	  DataBase db=new DataBase();
	   ResultSet rst= null;
	   rst=db.executeQuery("execute sp_gol_getvalidatecode '"+phs_num+"'");
	   while(rst.next()){
		   	strs[0]=rst.getString("return");
			strs[1]=rst.getString("msg");
			strs[2]=rst.getString("code");
	   }
	   rst.close();
	   db.closeStmt();
	   db.closeConn();
return   strs;   
}   
public   String [] checkCode(String phs_num,String code) throws SQLException   
{
	String[] strs = new String[2];
	  DataBase db=new DataBase();
	   ResultSet rst= null;
	   rst=db.executeQuery("execute sp_gol_checkvalidatecode '"+phs_num+"','"+code+"'");
	   while(rst.next()){
		   	strs[0]=rst.getString("return");
			strs[1]=rst.getString("msg");
	   }
	   rst.close();
	   db.closeStmt();
	   db.closeConn();
return   strs;   
}   
public static void main(String [] args){
	String[] strs = new String[3];
	try {
		//strs=new ValidateCode().checkCode("02400000011","92243");
		strs=new ValidateCode().getCode("02412345678");
		System.out.println(strs[0]+"--"+strs[1]+"--");
	} catch (NumberFormatException e) {
	} catch (SQLException e) {
	}
}
}